package com.gable.report.thread;

import com.gable.report.service.SetRepeatRepairService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * 设置重复维修
 * Created by gable on 2018/8/8.
 */
public class SetRepairRepeatThread implements Runnable {

    private static final Log logger = LogFactory.getLog(SetRepairRepeatThread.class);

    private SetRepeatRepairService setRepeatRepairService;

    private Long id;        //医院或者区域id

    private Integer tag;    //1:医院 2：区域

    public SetRepairRepeatThread(SetRepeatRepairService setRepeatRepairService, Long id, Integer tag) {
        this.setRepeatRepairService = setRepeatRepairService;
        this.id = id;
        this.tag = tag;
    }

    @Override
    public void run() {
        try {
            if(this.tag == 1){
                setRepeatRepairService.setIfRepeatRepair(id);
            }else{
                setRepeatRepairService.setIfAreaRepeatRepair(id);
            }
        } catch (Exception e) {
            e.printStackTrace();
            logger.error("tag: " + tag +"id: " + id +" 设置重复维修失败");
        }
    }
}
